<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>登录</title>
    <script rel="script" src="../js/pho.js" type="text/javascript">

    </script>
    <link href="../css/index.css" rel="stylesheet" type="text/css">
</head>
<body onload="lun()">
<form action="deng.php" method="post">

<div align="center"><img class="top1" src="../tupian/top1.png">
<div><img class="top3" src="../tupian/top2.png"></div>
<div style="height: 15px;">
    <a href="index.php"><div class="a1">首页 </div></a>
    <a href="index1.php"> <div class="a2">环境与资源</div></a>
    <a href="index2.php"><div class="a2">经济概述</div></a>
    <a href="index3.php"> <div class="a2">旅游景点</div></a>
    <a href="index4.php"> <div  class="a2">历史文化</div></a>
</div><hr>
<div ><img class="de2" src="../tupian/51.jpg"></div>
    <div class="de1">
        <p>账号登陆</p>
        <label for="">选择类型：</label>
        <select name="occup">
            <option value="用户">用户</option>
            <option value="管理员">管理员</option>
        </select>
        <p>用户名：<input type="text" name="name"></p>
        <p>密&nbsp;&nbsp;&nbsp;码：<input type="password" name="pswd"></p>
         <p><input type="submit"; value="登陆" style="width: 230px;height: 30px;" name="deng"></p>

        <p><h6><a href="zhu.php">立即注册</a></h6></p>
    </div>
    <div class="d1">
        <div class="d2">
            <div align="center" class="d3">合作</div>
            <a href="he1.php"><div align="center" class="d4">关于我们</div></a>
            <a href="he2.php"><div align="center" class="d4">联系我们</div></a>
        </div>
        <div class="d2">
            <div align="center" class="d3">官方</div>
            <a href="guan1.php"><div align="center" class="d4">新浪微博</div></a>
            <a href="guan2.php"><div align="center" class="d4">官方微信</div></a>
        </div>
        <div class="d2">
            <div align="center" class="d3">反馈</div>
            <a href="fan1.php"><div align="center" class="d4">帮助中心</div></a>
            <a href="fan2.php"><div align="center" class="d4">用户反馈</div></a>
        </div>
    <div class="l1">Copyright &copy;2019-2020&nbsp;&nbsp;作者：信息学院，B1831，刘泽庆</div>
</div>
</form>
</body>
</html>
<?php
 session_start(); //启动session
if($_SERVER['REQUEST_METHOD']='POST'&&isset($_POST['name'])){
   $_SESSION['username']=$_POST['name'];//定义session变量
    $_SESSION['passwd']=$_POST['pswd'];//定义session变量
}
if($_SERVER['REQUEST_METHOD']='POST'){
    $name=$_POST['name'];
    $pswd=$_POST['pswd'];
    if(empty($name)&&isset($_POST['deng'])){
        echo "<script>alert('用户名不能为空')</script>";
        exit;
    }
    if(empty($pswd)&&isset($_POST['deng'])){
        echo "<script>alert('密码不能为空')</script>";
        exit;
    }
}

if(isset($_POST['deng'])){
    header("location:index.php");//页面跳转
}
?>